@import '../../../../../variables';

:host {
  display: block;

  &:focus {
    outline: none;
  }

  &::ng-deep task ::ng-deep {
    margin: 2px;

    .parent-title {
      display: none;
    }

    tag-list {
      display: none;
    }

    .drag-handle {
      // since not draggable
      display: none;
    }

    .title-and-tags-wrapper {
      margin-left: $s * 2;
    }

    .box {
      @include lightTheme {
        border-color: $light-theme-extra-border-color;
        bottom: 0;
        top: -1px;
      }

      @include darkTheme {
        box-shadow: $whiteframe-shadow-1dp;
        background: $dark16 !important;
      }
    }
  }
}

// SHARED
// ------
.input-item,
.mat-expansion-panel {
  box-shadow: none;
  //overflow: inherit !important;
  border-width: 1px;
  border-style: solid;
  margin: 8px;
  border-radius: $card-border-radius * 1;
  //overflow: visible;
  border-color: transparent;

  :host-context(.isNoTouchOnly):focus & {
    border: 1px solid $c-focus-border;
    border-color: $c-focus-border !important;
  }

  &,
  ::ng-deep & .mat-expansion-panel-header {
    font-size: 14px;
  }

  ::ng-deep & .mat-expansion-panel-header-title {
    ::ng-deep mat-icon:first-of-type {
      margin-right: $s;
    }
  }

  @include darkTheme() {
    background: $dark10;
    box-shadow: $whiteframe-shadow-1dp;
    //border-color: $dark-theme-separator-color;
  }
  @include lightTheme {
    background: #fff;
    border-color: $light-theme-extra-border-color;
    //border-color: $light-theme-separator-color;
  }
}

mat-expansion-panel::ng-deep .mat-expansion-panel-header:not(.mat-expanded),
.input-item.standard-size {
  &:hover,
  &:focus {
    :host-context(.isNoTouchOnly.isLightTheme) & {
      background: #eee;
    }

    :host-context(.isNoTouchOnly.isDarkTheme) & {
      background: $dark-theme-bg-lightest;
    }
  }
}

// PANEL
// -----
:host::ng-deep {
  .mat-expansion-panel:not([class*='mat-elevation-z']) {
    box-shadow: none;
  }

  .mat-expansion-panel-body {
    padding: 0;
  }

  .mat-expansion-panel-header {
    position: sticky;
    top: 0;
  }

  .mat-expansion-panel-header-title {
    flex-grow: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;

    //min-width: 130px;
  }

  .mat-expansion-panel-header-description {
    text-align: right;

    > * {
      margin-left: auto;
      display: flex;
      align-items: center;
    }
  }
}

.panel-content-wrapper {
  margin: 0 $s $s;
  display: block;
  @include standardThemeTextColorLessIntense();

  &::ng-deep inline-markdown {
    &.isFocused {
      border-color: transparent;
    }

    .markdown-wrapper {
      min-height: 60px;
      border-radius: $card-border-radius * 1;
      overflow: visible !important;
      transition: $transition-standard;

      @include lightTheme {
        background: $light-theme-bg;
        //border: 1px solid $light-theme-extra-border-color;
      }
      @include darkTheme() {
        border-radius: $card-border-radius;
        background: $dark-theme-bg-lightest;
        box-shadow: $whiteframe-shadow-1dp;
      }
    }

    &.isFocused .markdown-wrapper {
      box-shadow: $whiteframe-shadow-3dp !important;
      border-color: transparent;
    }

    .markdown-unparsed,
    .markdown-parsed {
      color: inherit;
      background-color: inherit;
    }
  }
}

:host::ng-deep issue-header > * {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
}

.ripple {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
}

// Input-Item
// ----------
.input-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  cursor: pointer;
  color: $light-theme-text-color;

  &.full-size {
    height: auto;
    min-height: 48px;
    align-items: flex-start;
    cursor: default;
  }

  @include darkTheme() {
    color: $dark-theme-text-color;
  }

  &.--estimate {
    progress-bar {
      @include lightTheme() {
        background: $light-theme-extra-border-color;
      }
      @include darkTheme() {
        background: $dark-theme-extra-border-color;
      }
    }

    &:hover progress-bar {
      background: $c-accent !important;
    }
  }
}

.input-item__title {
  display: flex;
  align-items: center;
  margin: 0 $s * 3;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 90px;
  flex-grow: 1;

  ::ng-deep mat-icon:first-of-type {
    margin-right: $s;
  }

  .full-size & {
    min-width: 40px;
    min-height: 48px;
    flex-grow: 0;
    margin-right: 0;
  }
}

.input-item__value {
  text-align: right;
  flex-grow: 0;
  display: flex;
  align-items: center;
  margin-right: $s * 3;

  .full-size & {
    min-width: 40px;
    flex-grow: 1;
    padding-top: 4px;
    padding-bottom: 4px;
    min-height: 48px;

    > * {
      display: block;
    }
  }

  &,
  ::ng-deep span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  // TODO find out if still needed
  //::ng-deep mat-icon {
  //  margin-right: $s;
  //  font-size: 32px;
  //  height: 32px;
  //  width: 32px;
  //}

  @include lightTheme() {
    color: rgba(
      var(--palette-foreground-secondary-text),
      var(--palette-foreground-secondary-text-alpha, 1)
    );
  }

  @include darkTheme() {
    color: rgba(255, 255, 255, 0.7);
  }

  > * {
    flex-grow: 1;
    margin-left: auto;
    text-align: right;
    display: inline-block;
  }
}

.input-item__edit-btn {
  //opacity: 0;
  margin-left: $s * -3;
  margin-right: $s;
  display: none !important;

  .input-item:hover & {
    //opacity: 1;
    display: block !important;
  }
}
